import { useClipboard } from 'use-clipboard-copy';
import React, { useEffect } from 'react';
import 'antd/dist/antd.css'
import {message } from 'antd'

function App() {
  const ref = React.createRef();
  console.log(ref);
  useEffect(() => {
    console.log(ref);
  }, [])
  const clipboard = useClipboard();
  const  doCopy = () => {
    clipboard.copy();
    message.success('成功复制到剪贴板')
  }
  return (
    <div>
      <input type="text" name="text" ref={ref} />
      <input ref={clipboard.target} />
      <button onClick={doCopy}>Copy</button>
    </div>
  )
}

export default App
